﻿<Serializable()> _
Public Class PortItem
    Implements IComparable


    Public Sub New()
        _ccID = Guid.NewGuid().ToString().Replace("-", "_")
    End Sub

    Private _ccID As String
    Public Property ccID() As String
        Get
            Return _ccID
        End Get
        Set(ByVal value As String)
            _ccID = value
        End Set
    End Property


    Private _ccName As String
    Public Property ccName() As String
        Get
            Return _ccName
        End Get
        Set(ByVal value As String)
            _ccName = value
        End Set
    End Property


    Private _netAddress As Byte
    Public Property NetAddress() As Byte
        Get
            Return _netAddress
        End Get
        Set(ByVal value As Byte)
            _netAddress = value
        End Set
    End Property

    Private _projectID As String
    Public Property projectID() As String
        Get
            Return _projectID
        End Get
        Set(ByVal value As String)
            _projectID = value
        End Set
    End Property

    Private _listNo As Integer
    Public Property listNo() As Integer
        Get
            Return _listNo
        End Get
        Set(ByVal value As Integer)
            _listNo = value
        End Set
    End Property

    Private _dateCreated As DateTime
    Public Property dateCreated() As DateTime
        Get
            Return _dateCreated
        End Get
        Set(ByVal value As DateTime)
            _dateCreated = value
        End Set
    End Property


    Private _remark As String
    Public Property remark() As String
        Get
            Return _remark
        End Get
        Set(ByVal value As String)
            _remark = value
        End Set
    End Property



    Private _line As Integer
    Public Property line() As Integer
        Get
            Return _line
        End Get
        Set(ByVal value As Integer)
            _line = value
        End Set
    End Property

    Private _connected As Boolean = False
    ''' <summary>
    ''' 当前是否能够连通
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property Connected() As Boolean
        Get
            Return _connected
        End Get
        Set(ByVal value As Boolean)
            _connected = value
        End Set
    End Property

    Public Overrides Function Equals(ByVal obj As Object) As Boolean
        If TypeOf obj Is PortItem Then
            If DirectCast(obj, PortItem).ccID = Me._ccID Then
                Return True
            Else
                Return False
            End If
        End If

        Return MyBase.Equals(obj)
    End Function


    Public Overrides Function ToString() As String
        Return Me._ccName
    End Function

    Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo
        If TypeOf obj Is PortItem Then
            If DirectCast(obj, PortItem).ccID = Me._ccID Then
                Return 1
            Else
                Return 0
            End If
        End If

        Return 0
    End Function

End Class
